package day3;

/**
 * @author oldliu
 * @since 1.0
 */
public class Jiaowuchu {
    String name="工大教务处";
    //计算平均分
    public float calcAvg(String name,float java,float sql,float csharp){
        System.out.println("给"+name+"计算平均分:");
        if(java<60)
            java=65;
        System.out.println("在计算中：java:"+java+",sql="+sql+",c# ="+csharp);
        float avg=(java+sql+csharp)/3;
        return avg;
    }
    //给学生算成绩
    public float calcAvg2(Student stu){
        System.out.println("在计算方法中:");
        System.out.println("给"+stu.name+"算平均分:");

        if(stu.java<60)
            stu.java=65;//!!!!!!!!!!!!!!!!!!!!!!!!!!
        stu.show();
        float avg=(stu.java+stu.sql+stu.csharp)/3;
        return avg;
    }
    //求java的平均分
    public float calcAvgOfJava(Student[]sr){
        float sum=0,avg=0;
        for(int i=0;i<sr.length;i++){
            sum+=sr[i].java;
        }
        avg= sum/sr.length;
        return avg;
    }
}
